﻿-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
Create PROCEDURE [dbo].[proc_InOutSide_Audit]
(
	@Id INT,
	@Out_Memo NVARCHAR(MAX)
)

AS
BEGIN

	UPDATE InOutSide
	SET Out_Date = GETDATE(),
		Out_Memo = @Out_Memo
	WHERE id=@Id
	
	UPDATE Customer
	SET ProtectName = (SELECT InOutSide.InSide FROM InOutSide WHERE InOutSide.Id=@id)
	WHERE CustomerId=(SELECT InOutSide.CusId FROM InOutSide WHERE InOutSide.id=@Id)

	SET NOCOUNT ON;

END